/*
 * @(#)MaintWorkflowProgressForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.workflow.web;

import java.sql.Timestamp;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.workflow.bean.WorkflowProgress;

/**
  MaintWorkflowProgressForm.java

  This class is the for web form purpose.

  @author      Angus Shiu
  @company     DCIVision Limited
  @creation date   03/12/2003
  @version     $Revision: 1.33 $
*/

public class MaintWorkflowProgressForm extends com.dcivision.setup.web.AbstractActionPermissionForm {

  public static final String REVISION = "$Revision: 1.33 $";

  private String workflowStepID = null;
  private String trackID = null;
  private String cancelFlag = null;
  private String completeFlag = null;
  private String seqNo = null;
  private String status = null;
  private Timestamp dueDate = null;
  private Timestamp nextStepDueDate = null;
  private String nextStepAllowAssignDueDate = null;
  private String nextStepDueDates = null;
  private int nextStepDueDateCount = 0;
  private String progressPriority = null;
  private String userDef1 = null;
  private String userDef2 = null;
  private String userDef3 = null;
  private String userDef4 = null;
  private String userDef5 = null;

  private String workflowCode = null;
  private String workflowVersion  = null;
  private String workflowDescription = null;
  private String workflowCategory = null;
  private String workflowRecordID = null;
  private String stepSeq = null;
  private String stepName = null;
  private String allowAssignDueDate = null;
  private String actionType = null;
  private String stepDescription = null;
  private String priority = null;
  private String startDate = null;
  private String endDate = null;
  private String updaterName = null;
  private String allowStop = GlobalConstant.FALSE;

  private String fileNames = null;
  private String displayFileNames = null;
  private FormFile uploadFile = null;
  private FormFile specialFile = null; //currently for check-in new document
  private String dmsFileNames = null;
  private String displayDmsFileNames = null;
  private String[] attachment = null;

  private String reason = null;
  private String flowType = null;
  private List attachmentList = null;

  private String[] progressUser = null;
  private String[] progressGroup = null;
  private String[] progressRole = null;
  
  private String actorType = null;
  private String[] actorTypes = null;

  private String[] userRecords = null;
  private String[] userGroups = null;
  private String[] userRoles = null;

  private String[] decision = null;
  private String decisionView = null;
  private boolean isCheckOut = false;
  private boolean nextStepIsCheckInAutoTask = false;
  private String checkInURL = null;
  private String checkInType = null;

  private String priorityRuleListValue = null;
  private boolean isAssignPriorityRuleNextStep = false;
  private String childCreateType = null;
  private Integer delegateUserRecordID  = null;
  
  private String notificationRuleListValue = null;
  private String otherNoPermissionData = null;
  
  private boolean interruptAble = false;
  
  private String dueDate1 = null;
  private String dueDate2 = null;
  private String dueDate3 = null;
  private String dueDate4 = null;
  private String dueDate5 = null;
  private String dueDate6 = null;
  private String dueDate7 = null;
  private String dueDate8 = null;
  private String dueDate9 = null;
  private String dueDate10 = null;

  /**
   * @return Returns the delegateUserRecordID.
   */
  public Integer getDelegateUserRecordID() {
    return delegateUserRecordID ;
  }

  /**
   * @param delegateUserRecordID The delegateUserRecordID to set.
   */
  public void setDelegateUserRecordID(Integer delegateUserRecordID) {
    this.delegateUserRecordID  = delegateUserRecordID;
  }

  /**
   * @return Returns the childCreateType.
   */
  public String getChildCreateType() {
    return childCreateType;
  }

  /**
   * @param childCreateType The childCreateType to set.
   */
  public void setChildCreateType(String childCreateType) {
    this.childCreateType = childCreateType;
  }
  public MaintWorkflowProgressForm() {
    super();
  }

  public String getWorkflowStepID() {
    return(this.workflowStepID);
  }

  public void setWorkflowStepID(String workflowStepID) {
    this.workflowStepID = workflowStepID;
  }

  public String getTrackID() {
    return(this.trackID);
  }

  public void setTrackID(String trackID) {
    this.trackID = trackID;
  }

  public String getCancelFlag() {
    return(this.cancelFlag);
  }

  public void setCancelFlag(String cancelFlag) {
    this.cancelFlag = cancelFlag;
  }

  public String getCompleteFlag() {
    return(this.completeFlag);
  }

  public void setCompleteFlag(String completeFlag) {
    this.completeFlag = completeFlag;
  }

  public String getSeqNo() {
    return(this.seqNo);
  }

  public void setSeqNo(String seqNo) {
    this.seqNo = seqNo;
  }

  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getUserDef1() {
    return(this.userDef1);
  }

  public void setUserDef1(String userDef1) {
    this.userDef1 = userDef1;
  }

  public String getUserDef2() {
    return(this.userDef2);
  }

  public void setUserDef2(String userDef2) {
    this.userDef2 = userDef2;
  }

  public String getUserDef3() {
    return(this.userDef3);
  }

  public void setUserDef3(String userDef3) {
    this.userDef3 = userDef3;
  }

  public String getUserDef4() {
    return(this.userDef4);
  }

  public void setUserDef4(String userDef4) {
    this.userDef4 = userDef4;
  }

  public String getUserDef5() {
    return(this.userDef5);
  }

  public void setUserDef5(String userDef5) {
    this.userDef5 = userDef5;
  }

  public String getWorkflowCode() {
    return (this.workflowCode);
  }

  public void setWorkflowCode(String workflowCode) {
    this.workflowCode = workflowCode;
  }

  public String getWorkflowVersion() {
    return (this.workflowVersion);
  }

  public void setWorkflowVersion(String workflowVersion) {
    this.workflowVersion = workflowVersion;
  }

  public String getWorkflowDescription() {
    return (this.workflowDescription);
  }

  public void setWorkflowDescription(String workflowDescription) {
    this.workflowDescription = workflowDescription;
  }

  public String getWorkflowCategory() {
    return (this.workflowCategory);
  }

  public void setWorkflowCategory(String workflowCategory) {
    this.workflowCategory = workflowCategory;
  }

  public String getWorkflowRecordID() {
    return (this.workflowRecordID);
  }

  public void setWorkflowRecordID(String workflowRecordID) {
    this.workflowRecordID = workflowRecordID;
  }

  public String getStepSeq() {
    return (this.stepSeq);
  }

  public void setStepSeq(String stepSeq) {
    this.stepSeq = stepSeq;
  }

  public String getStepName() {
    return (this.stepName);
  }

  public void setStepName(String stepName) {
    this.stepName = stepName;
  }

  public String getActionType() {
    return (this.actionType);
  }

  public void setActionType(String actionType) {
    this.actionType = actionType;
  }

  public String getStepDescription() {
    return (this.stepDescription);
  }

  public void setStepDescription(String stepDescription) {
    this.stepDescription = stepDescription;
  }

  public String getPriority() {
    return (this.priority);
  }

  public void setPriority(String priority) {
    this.priority = priority;
  }

  public String getAllowStop() {
    return(this.allowStop);
  }

  public void setAllowStop(String allowStop) {
    if (allowStop != null) {
      this.allowStop = allowStop;
    }
  }

  public String getStartDate() {
    return (this.startDate);
  }

  public void setStartDate(String startDate) {
    this.startDate = startDate;
  }

  public String getEndDate() {
    return (this.endDate);
  }

  public void setEndDate(String endDate) {
    this.endDate = endDate;
  }

  public String getFileNames() {
    return (this.fileNames);
  }

  public void setFileNames(String fileNames) {
    this.fileNames = fileNames;
  }

  public String getDisplayFileNames() {
    return (this.displayFileNames);
  }

  public void setDisplayFileNames(String displayFileNames) {
    this.displayFileNames = displayFileNames;
  }

  public String getDisplayDmsFileNames() {
    return (this.displayDmsFileNames);
  }

  public void setDisplayDmsFileNames(String displayDmsFileNames) {
    this.displayDmsFileNames = displayDmsFileNames;
  }

  public FormFile getUploadFile() {
    return (this.uploadFile);
  }

  public void setUploadFile(FormFile uploadFile) {
    this.uploadFile = uploadFile;
  }

  public FormFile getSpecialFile() {
    return (this.specialFile);
  }

  public void setSpecialFile(FormFile specialFile) {
    this.specialFile = specialFile;
  }

  public String[] getAttachment() {
    return (this.attachment);
  }

  public void setAttachment(String[] attachment) {
    this.attachment = attachment;
  }

  public String getReason() {
    return (this.reason);
  }

  public void setReason(String reason) {
    this.reason = reason;
  }

  public String getFlowType() {
    return (this.flowType);
  }

  public void setFlowType(String flowType) {
    this.flowType = flowType;
  }

  public List getAttachmentList() {
    return (this.attachmentList);
  }

  public void setAttachmentList(List attachmentList) {
    this.attachmentList = attachmentList;
  }

  public String[] getProgressUser() {
    return this.progressUser;
  }

  public void setProgressUser(String[] progressUser) {
    this.progressUser = progressUser;
  }

  public String[] getProgressGroup() {
    return this.progressGroup;
  }

  public void setProgressGroup(String[] progressGroup) {
    this.progressGroup = progressGroup;
  }

  public String[] getProgressRole() {
    return this.progressRole;
  }

  public void setProgressRole(String[] progressRole) {
    this.progressRole = progressRole;
  }

  public void setDmsFileNames(String dmsFileNames){
    this.dmsFileNames = dmsFileNames;
  }

  public String getDmsFileNames(){
    return this.dmsFileNames;
  }

  public void setDecision(String[] decision) {
    this.decision = decision;
  }

  public String[] getDecision() {
    return this.decision;
  }
  
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setWorkflowStepID(null);
    this.setTrackID(null);
    this.setCancelFlag(null);
    this.setCompleteFlag(null);
    this.setSeqNo(null);
    this.setStatus(null);
    this.setDueDate(null);
    this.setNextStepDueDates(null);
    this.setProgressPriority(null);
    this.setUserDef1(null);
    this.setUserDef2(null);
    this.setUserDef3(null);
    this.setUserDef4(null);
    this.setUserDef5(null);
    this.setAttachment(null);
    this.setFlowType(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
    this.setDmsFileNames(null);
    this.setDecision(null);
    this.setAllowAssignDueDate(null);
    this.setNextStepDueDate(null);
    this.setNextStepAllowAssignDueDate(null);
    this.setUpdaterName(null);
    this.setPriorityRuleListValue(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    WorkflowProgress tmpWorkflowProgress = new WorkflowProgress();
    tmpWorkflowProgress.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpWorkflowProgress.setWorkflowStepID(TextUtility.parseIntegerObj(this.getWorkflowStepID()));
    tmpWorkflowProgress.setTrackID(TextUtility.parseIntegerObj(this.getTrackID()));
    tmpWorkflowProgress.setCancelFlag(this.getCancelFlag());
    tmpWorkflowProgress.setCompleteFlag(this.getCompleteFlag());
    tmpWorkflowProgress.setSeqNo(TextUtility.parseIntegerObj(this.getSeqNo()));
    tmpWorkflowProgress.setStatus(this.getStatus());
    tmpWorkflowProgress.setDueDate(this.dueDate);
    tmpWorkflowProgress.setDelegateUserRecordID(this.getDelegateUserRecordID());
    tmpWorkflowProgress.setAllowStop(this.getAllowStop());
    tmpWorkflowProgress.setNextStepDueDates(this.nextStepDueDates);
    tmpWorkflowProgress.setNextStepDueDate(this.nextStepDueDate);
    tmpWorkflowProgress.setNextStepDueDates(this.nextStepDueDates);
    tmpWorkflowProgress.setNextStepAllowAssignDueDate(this.nextStepAllowAssignDueDate);
    tmpWorkflowProgress.setProgressPriority(this.getProgressPriority());
    tmpWorkflowProgress.setUserDef1(this.getUserDef1());
    tmpWorkflowProgress.setUserDef2(this.getUserDef2());
    tmpWorkflowProgress.setUserDef3(this.getUserDef3());
    tmpWorkflowProgress.setUserDef4(this.getUserDef4());
    tmpWorkflowProgress.setUserDef5(this.getUserDef5());
    tmpWorkflowProgress.setAllowAssignDueDate(this.getAllowAssignDueDate());
    tmpWorkflowProgress.setRecordStatus(this.getRecordStatus());
    tmpWorkflowProgress.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpWorkflowProgress.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpWorkflowProgress.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpWorkflowProgress.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpWorkflowProgress.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    tmpWorkflowProgress.setUpdaterName(this.getUpdaterName());
    tmpWorkflowProgress.setPriorityRuleListValue(this.getPriorityRuleListValue());
    return tmpWorkflowProgress;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    WorkflowProgress tmpWorkflowProgress = (WorkflowProgress)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpWorkflowProgress.getID()));
    this.setWorkflowStepID(TextUtility.formatIntegerObj(tmpWorkflowProgress.getWorkflowStepID()));
    this.setTrackID(TextUtility.formatIntegerObj(tmpWorkflowProgress.getTrackID()));
    this.setDelegateUserRecordID(tmpWorkflowProgress.getDelegateUserRecordID());
    this.setCancelFlag(tmpWorkflowProgress.getCancelFlag());
    this.setCompleteFlag(tmpWorkflowProgress.getCompleteFlag());
    this.setSeqNo(TextUtility.formatIntegerObj(tmpWorkflowProgress.getSeqNo()));
    this.setStatus(tmpWorkflowProgress.getStatus());
    this.setDueDate(tmpWorkflowProgress.getDueDate());
    this.setAllowStop(tmpWorkflowProgress.getAllowStop());
    this.setNextStepDueDates(tmpWorkflowProgress.getNextStepDueDates());
    this.setProgressPriority(tmpWorkflowProgress.getProgressPriority());
    this.setUserDef1(tmpWorkflowProgress.getUserDef1());
    this.setUserDef2(tmpWorkflowProgress.getUserDef2());
    this.setUserDef3(tmpWorkflowProgress.getUserDef3());
    this.setUserDef4(tmpWorkflowProgress.getUserDef4());
    this.setUserDef5(tmpWorkflowProgress.getUserDef5());
    this.setRecordStatus(tmpWorkflowProgress.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpWorkflowProgress.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpWorkflowProgress.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpWorkflowProgress.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpWorkflowProgress.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpWorkflowProgress.getUpdateDate()));
    this.setUpdaterName(tmpWorkflowProgress.getUpdaterName());

    // PRESENTATION INFORMATION
    this.setWorkflowCode(tmpWorkflowProgress.getWorkflowCode());
    this.setWorkflowVersion(tmpWorkflowProgress.getWorkflowVersion());
    this.setWorkflowDescription(tmpWorkflowProgress.getWorkflowDescription());
    this.setWorkflowCategory(tmpWorkflowProgress.getWorkflowCategory());
    this.setWorkflowRecordID(TextUtility.formatIntegerObj(tmpWorkflowProgress.getWorkflowRecordID()));
    this.setStepSeq(TextUtility.formatIntegerObj(tmpWorkflowProgress.getStepSeq()));
    this.setStepName(tmpWorkflowProgress.getStepName());
    this.setAllowAssignDueDate(tmpWorkflowProgress.getAllowAssignDueDate());
    this.setActionType(tmpWorkflowProgress.getActionType());
    this.setStepDescription(tmpWorkflowProgress.getStepDescription());
    this.setPriority(tmpWorkflowProgress.getPriority());
    this.setStartDate(formatTimestamp(tmpWorkflowProgress.getStartDate()));
    this.setEndDate(formatTimestamp(tmpWorkflowProgress.getEndDate()));
    this.setNextStepDueDate(tmpWorkflowProgress.getNextStepDueDate());
    this.setNextStepAllowAssignDueDate(tmpWorkflowProgress.getNextStepAllowAssignDueDate());
    this.setNextStepDueDates(tmpWorkflowProgress.getNextStepDueDates());
    this.setPriorityRuleListValue(tmpWorkflowProgress.getPriorityRuleListValue());
  }

  public Timestamp getDueDate(){
    return this.dueDate;
  }

  public void setDueDate(Timestamp dueDate){
    this.dueDate = dueDate;
  }

  public String getAllowAssignDueDate(){
    return this.allowAssignDueDate;
  }

  public void setAllowAssignDueDate(String allowAssignDueDate){
    this.allowAssignDueDate = allowAssignDueDate;
  }

  public Timestamp getNextStepDueDate(){
    return this.nextStepDueDate;
  }

  public void setNextStepDueDate(Timestamp nextStepDueDate){
    this.nextStepDueDate = nextStepDueDate;
  }

  public String getNextStepAllowAssignDueDate(){
    return this.nextStepAllowAssignDueDate;
  }

  public void setNextStepAllowAssignDueDate(String nextStepAllowAssignDueDate){
    this.nextStepAllowAssignDueDate = nextStepAllowAssignDueDate;
  }

  public String getNextStepDueDates(){
    return this.nextStepDueDates;
  }

  public void setNextStepDueDates(String nextStepDueDates) {
    this.nextStepDueDates = nextStepDueDates;
  }

  public int getNextStepDueDateCount(){
    return this.nextStepDueDateCount;
  }

  public void setNextStepDueDateCount(int nextStepDueDateCount){
    this.nextStepDueDateCount = nextStepDueDateCount;
  }

  public String getUpdaterName(){
    return this.updaterName;
  }

  public void setUpdaterName (String updaterName) {
    this.updaterName = updaterName;
  }

  /**
   * @return Returns the decisionView.
   */
  public String getDecisionView() {
    return decisionView;
  }

  /**
   * @param decisionView The decisionView to set.
   */
  public void setDecisionView(String decisionView) {
   this.decisionView = decisionView;
  }

  public boolean isCheckOut(){
    return this.isCheckOut;
  }

  public void setCheckOut(boolean isCheckOut){
    this.isCheckOut = isCheckOut;
  }

  public boolean nextStepIsCheckInAutoTask(){
    return this.nextStepIsCheckInAutoTask;
  }

  public void setNextStepIsCheckInAutoTask(boolean isCheckInAutoTask){
    this.nextStepIsCheckInAutoTask = isCheckInAutoTask;
  }

  public String getCheckInURL(){
    return this.checkInURL;
  }

  public void setCheckInURL(String checkInURL){
    this.checkInURL = checkInURL;
  }

  public String getCheckInType(){
    return this.checkInType;
  }

  public void setCheckInType(String checkInType) {
    this.checkInType = checkInType;
  }

  public String getProgressPriority(){
    return this.progressPriority;
  }

  public void setProgressPriority(String progressPriority){
    this.progressPriority = progressPriority;
  }

  public String getPriorityRuleListValue(){
    return this.priorityRuleListValue;
  }

  public void setPriorityRuleListValue(String priorityRuleListValue) {
    this.priorityRuleListValue = priorityRuleListValue;
  }

  public boolean isAssignPriorityRuleNextStep(){
    return this.isAssignPriorityRuleNextStep;
  }

  public void setIsAssignPriorityRuleNextStep(boolean isAssignPriorityRuleNextStep){
    this.isAssignPriorityRuleNextStep = isAssignPriorityRuleNextStep;
  }
  
  public String getActorType() {
    return actorType;
  }
  public void setActorType(String actorType) {
    this.actorType = actorType;
  }
  
  public String getNotificationRuleListValue() {
    return notificationRuleListValue;
  }
  
  public void setNotificationRuleListValue(String notificationRuleListValue) {
    this.notificationRuleListValue = notificationRuleListValue;
  }
  
  
  public boolean isInterruptAble() {
    return interruptAble;
  }
  
  public void setInterruptAble(boolean interruptAble) {
    this.interruptAble = interruptAble;
  }
  
  public String[] getActorTypes() {
    return actorTypes;
  }
  
  public void setActorTypes(String[] actorTypes) {
    this.actorTypes = actorTypes;
  }
  
  public String[] getUserGroups() {
    return userGroups;
  }
  
  public void setUserGroups(String[] userGroups) {
    this.userGroups = userGroups;
  }
  
  public String[] getUserRecords() {
    return userRecords;
  }
  
  public void setUserRecords(String[] userRecords) {
    this.userRecords = userRecords;
  }
  
  public String[] getUserRoles() {
    return userRoles;
  }
  
  public void setUserRoles(String[] userRoles) {
    this.userRoles = userRoles;
  }
  
  
  public String getOtherNoPermissionData() {
    return otherNoPermissionData;
  }
  
  public void setOtherNoPermissionData(String otherNoPermissionData) {
    this.otherNoPermissionData = otherNoPermissionData;
  }
  
  public String getDueDate1() {
    return dueDate1;
  }
  
  public void setDueDate1(String dueDate1) {
    this.dueDate1 = dueDate1;
  }
  
  public String getDueDate10() {
    return dueDate10;
  }
  
  public void setDueDate10(String dueDate10) {
    this.dueDate10 = dueDate10;
  }
  
  public String getDueDate2() {
    return dueDate2;
  }
  
  public void setDueDate2(String dueDate2) {
    this.dueDate2 = dueDate2;
  }
  
  public String getDueDate3() {
    return dueDate3;
  }
  
  public void setDueDate3(String dueDate3) {
    this.dueDate3 = dueDate3;
  }
  
  public String getDueDate4() {
    return dueDate4;
  }
  
  public void setDueDate4(String dueDate4) {
    this.dueDate4 = dueDate4;
  }
  
  public String getDueDate5() {
    return dueDate5;
  }
  
  public void setDueDate5(String dueDate5) {
    this.dueDate5 = dueDate5;
  }
  
  public String getDueDate6() {
    return dueDate6;
  }
  
  public void setDueDate6(String dueDate6) {
    this.dueDate6 = dueDate6;
  }
  
  public String getDueDate7() {
    return dueDate7;
  }
  
  public void setDueDate7(String dueDate7) {
    this.dueDate7 = dueDate7;
  }
  
  public String getDueDate8() {
    return dueDate8;
  }
  
  public void setDueDate8(String dueDate8) {
    this.dueDate8 = dueDate8;
  }
  
  public String getDueDate9() {
    return dueDate9;
  }
  
  public void setDueDate9(String dueDate9) {
    this.dueDate9 = dueDate9;
  }
}
